package com.keepsport.keepsportapi.controller;

import com.keepsport.keepsportapi.config.SystemConfig;
import com.keepsport.keepsportapi.service.intf.UserIntegralService;
import com.keepsport.keepsportapi.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 *
 @Author YK
 @create 2022/7/1 20:47
 */
@RestController
@Api(tags = "签到接口")
@RequestMapping("/api/userintegral/")
@CrossOrigin
public class UserIntegralController {
    @Autowired
    private UserIntegralService service;

    @ApiOperation(value = "签到")
    @GetMapping("add.do")
    public R addIntegral(HttpServletRequest request) {
       // System.out.println(request.getIntHeader(SystemConfig.TOKEN_HEADER));
        return service.signIn(request.getIntHeader(SystemConfig.TOKEN_HEADER));
        //return service.signIn(token);
    }

    @ApiOperation(value = "查询积分等级")
    @GetMapping("selectsign.do")
    public R selectSign(HttpServletRequest request) {
        return service.selectSign(request.getIntHeader(SystemConfig.TOKEN_HEADER));
    }

}
